//主类
import java.security.PublicKey;
import java.sql.SQLOutput;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        ArrayList<Zookeeper> zookeepers =new ArrayList<Zookeeper>();
        ArrayList<Mammal>  mammal=new ArrayList<Mammal>();
        ArrayList<Insect> insect =new ArrayList<Insect>();
        ArrayList<Oviparous> oviparous =new ArrayList<Oviparous>();
        ArrayList<Bird> bird =new ArrayList<Bird>();
        Scanner sc=new Scanner(System.in);



        String animalType;
        int age;
        String name;
        int n;

        System.out.println("请输入管理员人数");
        n=sc.nextInt();
        for(int x=1;x<=n;x++) {
            System.out.println("请输入第" + x + "个管理员的姓名：");
            name = sc.next();
            System.out.println("请输入第" + x + "个管理员年龄：");
            age = sc.nextInt();
            Zookeeper z = new Zookeeper(name, age);
            zookeepers.add(z);
            System.out.println("-----------------------------");
        }

        System.out.println("请输入哺乳动物种类数");
        n=sc.nextInt();
        for(int x=1;x<=n;x++) {
            System.out.println("请输入第" + x + "个哺乳动物的种类：");
            animalType = sc.next();
            System.out.println("请输入" + animalType + "年龄：");
            age = sc.nextInt();
            Mammal m = new Mammal(animalType, age);
            mammal.add(m);
            System.out.println("-----------------------------");
        }

        System.out.println("请输入卵生动物种类数");
        n=sc.nextInt();
        for(int x=1;x<=n;x++) {
            System.out.println("请输入第" + x + "个卵生动物的种类：");
            animalType = sc.next();
            System.out.println("请输入" + animalType + "年龄：");
            age = sc.nextInt();
            Oviparous o = new Oviparous(animalType, age);
            oviparous.add(o);
            System.out.println("-----------------------------");
        }

        System.out.println("请输入昆虫种类数");
        n=sc.nextInt();
        for(int x=1;x<=n;x++) {
            System.out.println("请输入第" + x + "个昆虫的种类：");
            animalType = sc.next();
            System.out.println("请输入" + animalType + "年龄：");
            age = sc.nextInt();
            Insect i = new Insect(animalType, age);
            insect.add(i);
            System.out.println("-----------------------------");
        }

        System.out.println("请输入鸟类种类数");
        n=sc.nextInt();
        for(int x=1;x<=n;x++) {
            System.out.println("请输入第" + x + "个鸟类种类：");
            animalType = sc.next();
            System.out.println("请输入" + animalType + "年龄：");
            age = sc.nextInt();
            Bird b = new Bird(animalType, age);
            bird.add(b);
            System.out.println("-----------------------------");
        }

        for (Zookeeper zk : zookeepers) {
            System.out.println("是否由" + zk.getAge() + "岁的" + zk.getName() + "去喂养动物(yes or no)");
            String a = sc.next();
            if (a.equals("yes")) {
                String food;
                for(Mammal ma : mammal)
                {
                    System.out.println("请输入喂给" + ma.getAnimalType() + "的食物");
                    food= sc.next();
                    zk.feedAnimal(ma,food);
                    ma.eat(food);
                    System.out.println("-----------------------------");
                }

                for(Oviparous op : oviparous)
                {
                    System.out.println("请输入喂给" + op.getAnimalType() + "的食物");
                    food= sc.next();
                    zk.feedAnimal(op,food);
                    op.eat(food);
                    System.out.println("-----------------------------");
                }

                for(Insect is : insect)
                {
                    System.out.println("请输入喂给" + is.getAnimalType() + "的食物");
                    food= sc.next();
                    zk.feedAnimal(is,food);
                    is.eat(food);
                    System.out.println("-----------------------------");
                }

                for(Bird bi : bird)
                {
                    System.out.println("请输入喂给" + bi.getAnimalType() + "的食物");
                    food= sc.next();
                    zk.feedAnimal(bi,food);
                    bi.eat(food);
                    System.out.println("-----------------------------");
                }
            } else {
                continue;
            }
        }


       /* // 创建动物实例
        Mammal m1 = new Mammal("熊猫", 2);
        Insect i1 = new Insect("蜜蜂", 1);
        Bird b1 = new Bird("火烈鸟", 3);
        Oviparous o1 = new Oviparous("泽龟", 4);

        // 创建饲养员实例
        Person p1 = new Zookeeper("饲养员张三", 40);
        Person p2 = new Zookeeper("饲养员李四", 30);

        p1.feedAnimal(m1, "竹子");
        m1.eat("竹子");
        m1.swim();
        m1.climb();

        p1.feedAnimal(i1, "糖水");
        i1.fly();

        p2.feedAnimal(b1, "水果");
        b1.fly();
        b1.swim();

        p2.feedAnimal(o1, "鱼");
        o1.climb();
        o1.swim();*/












    /*while(true) {
            System.out.println("------------------欢迎来到动物园管理系统-----------------------");
            System.out.println("------              1. 查看动物信息                      -----");
            System.out.println("------              2. 添加动物                          -----");
            System.out.println("------              3. 查看管理员信息                     -----");
            System.out.println("------              4. 添加管理员                        -----");
            System.out.println("------              5. 选择喂养动物的管理员               -----");
            System.out.println("------              6. 退出                              -----");
            System.out.println("--------------------------------------------------------------");
            System.out.print("请输入您的选择：");
            String a=sc.next();
            switch (a) {
                case "1":
                    lookAinmal(mammal,oviparous,insect,bird);
                case "2":
                case "3":
                case "4":
                case "5":

                case "6":
                    System.exit(0);
                    break;
                default:
                    System.out.println("输入错误,请重新输入");
            }
        }*/

    }


}